<ul class="am-avg-sm-2 dux-tabs">
    <li class="active">
        <a href="{url('index')}">账户充值</a>
    </li>
    <li class="">
        <a href="{url('log')}">充值记录</a>
    </li>
</ul>

<main class="dux-layout-page">
    <div class="dux-recharge am-cf">
        <a href="javascript:;" data-money="50" class="active">50元</a>
        <a href="javascript:;" data-money="100">100元</a>
        <a href="javascript:;" data-money="200">200元</a>
        <a href="javascript:;" data-money="500">500元</a>
        <a href="javascript:;" data-money="1000">1000元</a>
        <input type="tel" placeholder="充值金额" id="money" name="money" value="">
    </div>
    <div class="dux-box">
        <ul class="dux-type-list">
            <!--loop{$payList as $type => $vo}-->
            <li class="am-cf">
                <label class="am-radio">
                    <input type="radio" name="type" value="{$type}">{$vo.name}
                </label>
            </li>
            <!--{/loop}-->
        </ul>
    </div>
    <br>
    <button class="am-btn am-btn-danger am-btn-block" type="button" id="pay">确认充值</button>
</main>
<script>
    Do('base', function () {
        $('.dux-recharge').on('click', 'a,input', function () {
            $(this).parents('div').find('a,input').removeClass('active');
            $(this).addClass('active');
            if ($(this).data('money')) {
                $('#money').val($(this).data('money'));
            }
        });
        $('#pay').click(function () {
            var money = $('#money').val();
            app.ajax({
                url: '{url()}',
                type: 'post',
                data: {
                    type: $('input[name="type"]:checked').val(),
                    money: money ? money : 50
                },
                success: function (msg, url) {
                    window.location.href = url;
                },
                error: function (msg) {
                    app.error(msg);
                }
            });
        });
    });
</script>
